home *** CD-ROM | disk | FTP | other *** search
- ================================================================================
- COLORCTL.TXT -- first, the text of the article in TechNotes (January, 1992)
- by the author of these programs (George E. McMullen), and then a brief
- description of the way they are used in the BORUSER system on the BORLAND BBS
- (BORBBS). If you examine the actual code (at the beginning) there are
- descriptions of the changes I made (minor) in the programs.
- (Ken Mayer, 06/12/1992)
- ================================================================================
-
- Eye Candy
- George E. McMullen
-
- More colors than you can shake a paintbrush at
-
- In today's ever increasing GUI (Graphical User Interface) world, applications
- that rely on DOS default colors seem rather archaic. As technology increases,
- so does the customer's expectations when purchasing a product or hiring a
- consultant.
-
- dBASE IV produces rather nice displays via screen saves and moving windows.
- It also gives you a decent assortment of colors to work with. But as we all
- know, there are thousands of shades and I thought that it was worthwhile to
- increase the the number of colors available in your dBASE IV applications.
- For instance, of all the many colors available on a VGA monitor, there is
- only a concise number of colors available to the dBASE programmerÆ’or so it
- would seem. You see, although dBASE IV provides only a limited number of color
- options, it also provides the interface for enhancing those colors and other
- options.
-
- The .BIN Interface
-
- One of the lesser used commands by developers, the LOAD command happens to be
- one of the most powerful commands in dBASE IV. Basically, the LOAD command
- places a binary (.BIN) file in memory where it can be accessed programatically
- using the complimentary CALL command. This .BIN interface allows dBASE IV the
- ability to communicate with the outside world. Once a link is achieved,
- dBASE IV can take control and direct streams of data producing unlimited
- capabilities. In an attempt to capitalize on this, companies have developed a
- mulitude of products for interfacing with hand scanners, lightbar readers,
- communication packages and graphical interfaces.
-
- ColorCtl.BIN (available from our BBS in the file COLORCTL.ZIP) provides
- dBASE IV with an interface for controlling DOS color settings. With this
- program, you can make changes to any one of 16 color settings by controlling
- the red, green and blue gun intensity values. The range of each color gun
- value is 0 - 63, which translates to over 260,000 possible color settings.
- The syntax to control color hues is:
-
- CALL ColorCtl WITH "/SET", "INDEX=x", "RED=n", "GREEN=n", "BLUE=n"
-
- where x and n are numerical values between 0-15 and 0-63 respectively
- (see table below).
-
- Option: Range: Description:
-
- INDEX = 0 - 15 DOS color index number
- RED = 0 - 63 Red gun value
- GREEN = 0 - 63 Green gun value
- BLUE = 0 - 63 Blue gun value
- DELAY = 0 - 99 Delay factor
-
- In addition, you can progressively change any one of 16 colors into another
- color value producing a "fading effect." This command also allows a delay
- factor for increased control. The syntax goes as follows:
-
- CALL ColorCtl WITH "/FADE", "INDEX=x","RED=n", "GREEN=n", "BLUE=n", "DELAY=n"
-
- Finally, you can reset one or all DOS colors back to factory settings using
- the syntax:
-
- CALL ColorCtl WITH "/RESET"
- CALL colorctl WITH "/RESET", "INDEX=x"
-
- Inside ColorCtl.BIN
-
- This code is an extract from a VGA 256 color control program that I wrote which
- was then converted to a .BIN file. Purists will please forgive me if the code
- isn't squeaky clean; it's the concept that's being emphasized here.
-
- The main fuctionality of ColorCtl.BIN comes from the Interrupt 10H BIOS service.
- The functions zSetAnalogHue and zReadAnalogHue use this service for setting and
- reading DOS color settings.
-
- Interupt 10H: VGA BIOS Services
-
- SET COLOR SERVICE:
- AH = 10H
- AL = 10H Set one color register
- BX = Color register to set (see DOS's translation table below)
- DH = Red value
- CH = Green value
- CL = Blue value
- READ COLOR SERVICE:
- AH = 10H
- AL = 15H Read one color register
- BX = Color register to read (see DOS's translation table below)
- RETURNS:
- DH = Red value
- CH = Green value
- CL = Blue value
-
- TRANSLATION TABLE: (COLORCTL.BIN Index Number/dBASE Color Codes)
-
- Index Number: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- dBASE Color: N B G GB R RB GR W N+ B+ G+ GB+ R+ RB+ GR+ W+
-
- *** The code for the C program to create the .BIN file and the (dBASE) programs
- *** SETCLR.PRG and CDEFAULT.PRG have been removed from here. You can download
- *** the original programs from the BORBBS by downloading the file:
- *** COLORCTL.ZIP, you can get the complete article (with the 'C' code attached)
- *** by downloading the file: TNDB0192.ZIP from the BORBBS, which contains the
- *** complete text of the issue of TechNotes that this article is from.
-
- --------------------------------------------------------------------------------
- END OF TECHNOTES ARTICLE -- On to Ken Mayer's Notes (a simpler explanation of
- what is happening ...)
- --------------------------------------------------------------------------------
-
- ------------
- COLORCTL.BIN
- ------------
-
- This file is a binary file, that can be used with dBASE (and probably other
- software as well), to change the color values of the actual colors used
- by the software (on a VGA monitor). What does this mean? It means that if, for
- example, you do not like the color of BLUE associated with the color 'B' in
- dBASE, you can change the values on a VGA monitor -- by actually changing how
- much color from each 'gun' in the monitor is sent to the monitor. There are
- three guns, RED, GREEN, and BLUE. By changing the values from these, you can
- get at least 256 shades of any color. Taking all three 'guns' to 0 will give
- you black ('N' in dBASE). Taking all three guns up to their maximum value
- (63) will give you white ('bright white' or 'W+' in dBASE).
-
- ------------
- CDEFAULT.PRG
- ------------
-
- This program loads the COLORCTL.BIN file into memory so it can be used, and
- then loads the 'current settings' in the file: CLRDESC.MEM. This file contains
- the 'current' settings of the guns. This information is loaded into an array,
- and then set via a loop using the COLORCTL.BIN file. The current settings are
- ones that I defined for this system. The actual system defaults can be
- restored/saved to CLRDESC.MEM via the SETCLR.PRG program. My original settings
- are in CLRDESC.FIL and are copied to the file CLRDESC.MEM by the menu program
- when you first run it, or the CONFIG.PRG program if you decide to change to VGA.
- These are my settings only. (Basically I altered the dark blue a bit to make it
- darker, and RED, CYAN and YELLOW to make them more vibrant ...)
-
- NOTE: the original programs used COLOR.MEM for this. I was already using a mem
- file called COLOR.MEM, which is why I renamed it to CLRDESC.MEM.
-
- ----------
- SETCLR.PRG
- ----------
-
- This is the program that is called when you tell the ATUSER system that you want
- to modify the VGA Color Values. This program is confusing to the first time
- user. There are a lot of things going on on the screen.
-
- THE SCREEN
- First, the program is showing the 16 colors you can use in dBASE via the
- SET COLOR [OF <area group>] TO <colors> commands (see the Language Reference,
- under SET COLOR for more information). This is the color bar you see across
- the top portion of the screen. In the middle is a box showing the 'current'
- color you are modifying, and the values from each 'gun' assigned currently to
- that color. The rest of the screen is information (some of which I added to the
- original program).
-
- LOAD OLD COLORS
- You can load the colors in the CLRDESC.MEM file by pressing the keystroke:
- <Ctrl><Home>. This will load the current settings. If you do not choose to do
- this, you get the default settings for dBASE (and the PC in general).
-
- CHANGING COLORS
- Using the left and right arrow keys allows you to select the actual color(s)
- to modify (signified by the box in the middle of the screen).
-
- To alter the color(s), use the <Home> and <End> keys to raise/lower the values
- of the RED gun; the Up/Down arrows to raise/lower the values of the GREEN gun;
- and the <PgUp>/<PgDn> keys to raise/lower the values of the BLUE gun.
-
- These combinations will change each color, producing some interesting effects.
-
- (As a side note, the only colors I'm using in the system are:
- Black (N)
- Bright White (W+)
- Yellow (RG+)
- Red (R)
- Cyan (GB)
- Blue (B)
- Just so that you know ... altering other colors won't really affect anything for
- this system.)
-
- SAVING COLORS
- You can save the colors you have changed by pressing: <Ctrl><End>
-
- EXIT
- Exiting this program is as simple as pressing the <Escape> key, however,
- if you have changed things, the program does NOT save, and does NOT ask if
- you WANT to save. (Handy, however, if you did something weird, and don't
- want to save it ...)
-
- --------------------------------------------------------------------------------
- END OF FILE: COLORCTL.TXT
- --------------------------------------------------------------------------------